/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cs575.dbentities;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;

/**
 *
 * @author bms
 */
@Embeddable
public class GroupInvitationPK implements Serializable {
    @Basic(optional = false)
    @Column(name = "group_id", nullable = false)
    private int groupId;
    @Basic(optional = false)
    @Column(name = "source_user_id", nullable = false)
    private int sourceUserId;
    @Basic(optional = false)
    @Column(name = "dest_user_id", nullable = false)
    private int destUserId;

    public GroupInvitationPK() {
    }

    public GroupInvitationPK(int groupId, int sourceUserId, int destUserId) {
        this.groupId = groupId;
        this.sourceUserId = sourceUserId;
        this.destUserId = destUserId;
    }

    public int getGroupId() {
        return groupId;
    }

    public void setGroupId(int groupId) {
        this.groupId = groupId;
    }

    public int getSourceUserId() {
        return sourceUserId;
    }

    public void setSourceUserId(int sourceUserId) {
        this.sourceUserId = sourceUserId;
    }

    public int getDestUserId() {
        return destUserId;
    }

    public void setDestUserId(int destUserId) {
        this.destUserId = destUserId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (int) groupId;
        hash += (int) sourceUserId;
        hash += (int) destUserId;
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof GroupInvitationPK)) {
            return false;
        }
        GroupInvitationPK other = (GroupInvitationPK) object;
        if (this.groupId != other.groupId) {
            return false;
        }
        if (this.sourceUserId != other.sourceUserId) {
            return false;
        }
        if (this.destUserId != other.destUserId) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "cs575.dbentities.GroupInvitationPK[ groupId=" + groupId + ", sourceUserId=" + sourceUserId + ", destUserId=" + destUserId + " ]";
    }
    
}
